package com.auxteam.elope.menus;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Advanceable;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockListFragment;
import com.auxteam.elope.LoginActivity;
import com.auxteam.elope.PlayerActivity;
import com.auxteam.elope.R;

public class DefaultMenuList extends SherlockListFragment{
	public SampleAdapter adapter;
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		return inflater.inflate(R.layout.list, null);
	}

	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		adapter = new SampleAdapter(getActivity());
		adapter.add(new SampleItem("Search", R.drawable.binoculars));
		adapter.add(new SampleItem("Log In", R.drawable.administrator));
		adapter.add(new SampleItem("Shop", R.drawable.shopping_basket));
		adapter.add(new SampleItem("Player", R.drawable.play));
		adapter.add(new SampleItem("Settings", R.drawable.gear));
		adapter.add(new SampleItem("Exit", R.drawable.power));
		setListAdapter(adapter);
	}
	
	@Override
	public void onListItemClick(ListView l, View v, int position, long id) {
		// TODO Auto-generated method stub
		if(position == 0){
			Toast.makeText(getActivity().getApplicationContext(), "Search Clicked", Toast.LENGTH_SHORT).show();
		}
		if(position == 1){
			//Toast.makeText(getActivity().getApplicationContext(), "Search Clicked", Toast.LENGTH_SHORT).show();
			startActivity(new Intent(getActivity().getApplicationContext(), LoginActivity.class));
		}
		if(position == 2){
			Toast.makeText(getActivity().getApplicationContext(), "Shop Clicked", Toast.LENGTH_SHORT).show();
		}
		if(position == 3){
			Toast.makeText(getActivity().getApplicationContext(), "Player Clicked", Toast.LENGTH_SHORT).show();
			//startActivity(new Intent(getActivity().getApplicationContext(), PlayerActivity.class));
		}
		if(position == 4){
			Toast.makeText(getActivity().getApplicationContext(), "Settings Clicked", Toast.LENGTH_SHORT).show();
		}
		if(position == 5){
			//Toast.makeText(getActivity().getApplicationContext(), "Search Clicked", Toast.LENGTH_SHORT).show();
			getActivity().finish();
		}
	}
}
